module.exports = app => {
    const seq = app.Sequelize;

    const ShopredRed = app.model.define('shopred_red', {
        id:{
            type:seq.INTEGER,
            autoIncrement:true,
            allowNull:false,
            primaryKey:true,
            unique:true
        },
        name:{
            type:seq.STRING,
            allowNull:false
        },
        total: {
            type:seq.STRING,
            allowNull:false
        },
        percent: {
            type:seq.INTEGER,
            allowNull:true,
        },
        min: {
            type:seq.INTEGER,
            allowNull:true,
        },
        max: {
            type:seq.INTEGER,
            allowNull:true,
        }
    },{
        timestamps:true,
        paranoid:true,
        underscored:false
    });

    ShopredRed.associate=function () {
        app.model.ShopredRed.hasOne(app.model.ShopredRecord);
        app.model.ShopredRed.hasMany(app.model.ShopredImg);
        app.model.ShopredRed.hasMany(app.model.ShopredHistory);
        app.model.ShopredRed.hasOne(app.model.ShopredConfig);
    };


    return ShopredRed;
};